﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class MainMenu : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["userName"] != null || Session["roleID"] != null)
        {
            if(!IsPostBack)
            {
                JudgeRole();
            }
        }
        else 
        {
            Response.Redirect("Login.aspx");
        }

    }
    /// <summary>
    /// 判断用户属于哪个角色，并分配相应的菜单目录
    /// </summary>
    protected void JudgeRole()
    {
        int roleID =Convert.ToInt32(Session["roleID"].ToString());
        switch (roleID)
        {
            case 1:
                PanelAdmin.Visible = true;
                break;
            case 2:
                PanelFunctionUser.Visible = true;
                break;
            case 3:
                PanelUser.Visible = true;
                break;
        }
    }
}
